package com.test.reactor_test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zxs
 * @version 1.0
 * @date 2019-03-18
 */
public class MyEventSource {

    private List<MyEventListener> listenerList=new ArrayList<>();

    public void register(MyEventListener eventListener){
        listenerList.add(eventListener);
    }

    public void newEvent(MyEvent event){
        listenerList.forEach(item->item.onNewEvent(event));
    }

    public void stopEvent(){
        listenerList.forEach(MyEventListener::onStopEvent);
    }

}
